package design.patterns.proxymode.dynamicProxy.service;

import design.patterns.proxymode.dynamicProxy.api.IAdvice;

import java.lang.reflect.Method;

/**
 * @Description :
 * @author: cww
 * @DateTime: 2018-07-24 23:55
 */

public class IAdviceImpl implements IAdvice {
    final long beginTime = System.currentTimeMillis();
    @Override
    public void beforMethod(Method method) throws InterruptedException {
        System.out.println("动态代理类执行开始，代理方法名为："+method.getName());
        Thread.sleep(1000);
    }

    @Override
    public void afterMethod(Method method) {
        System.out.println("动态代理类执行结束,执行时间为："+(System.currentTimeMillis()-beginTime));

    }
}
